package com.interest.plus2.view.mainview;

import com.interest.plus2.ResourceTable;
import ohos.agp.components.AttrSet;
import ohos.agp.components.webengine.WebView;
import ohos.app.Context;

/**
 * 口才课
 */
public class HomeView extends BaseView {
    public HomeView(Context context) {
        super(context);
    }

    public HomeView(Context context, AttrSet attrSet) {
        super(context, attrSet);
    }

    public HomeView(Context context, AttrSet attrSet, String styleName) {
        super(context, attrSet, styleName);
    }

    @Override
    int getLayoutId() {
        return ResourceTable.Layout_mainview_home;
    }

    @Override
    void initView() {
        WebView webview = (ohos.agp.components.webengine.WebView) findComponentById(ResourceTable.Id_homewebView);
        webview.getWebConfig().setJavaScriptPermit(true);  // 如果网页需要使用JavaScript，增加此行；如何使用JavaScript下文有详细介绍
        final String url = "https://www.baidu.com/"; // EXAMPLE_URL由开发者自定义
        webview.load(url);
    }
}
